<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">

<body>


<div th:if="${#httpServletRequest.remoteUser == null}">
    <a th:href="@{/login}">登录</a>
</div>

<div th:if="${#httpServletRequest.remoteUser != null}">
    <h3 th:inline="text">Hello [[${#httpServletRequest.remoteUser}]]!</h3>
    <form th:action="@{/logout}" method="POST">
        <input type="submit" value="退出"/>
    </form>
</div>

<table border="3">
    <caption style="border: solid gray; border-width: 3px 3px 0 3px">　　　　　<b>用户信息</b>　　　
        <a th:href="@{/insertUserPage}">新增</a>
    </caption>
    <tr>
        <td>编号</td>
        <td>姓名</td>
        <td>年龄</td>
        <td>性别</td>
        <td>操作</td>
    </tr>
    <tr th:each="user : ${userList}">
        <td th:text="${user.id}"></td>
        <td th:text="${user.name}"></td>
        <td th:text="${user.age}"></td>
        <td th:text="${user.sex}"></td>
        <td><a th:href="@{/deleteUserById(id=${user.id})}">删除</a></td>
    </tr>
</table>



</body>
</html>